package com.lijy.vue.rest.controller;

import com.lijy.vue.rest.entity.Result;
import com.lijy.vue.rest.entity.UserEntity;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api")
public class LoginController {

    @RequestMapping("/login")
    public Result login(@RequestBody UserEntity userEntity){
        if(null==userEntity){
            return Result.fail(1,"参数为空");
        }
        if(userEntity.getUsername().equals("admin")&&userEntity.getPassword().equals("123456")){
            return Result.success("success");
        }
        return Result.fail(2,"登录失败");
    }
}
